package com.kaver.sso.dao.service.impl;

import com.kaver.sso.dao.po.SsoUser;
import com.kaver.sso.dao.mapper.SsoUserMapper;
import com.kaver.sso.dao.service.SsoUserDao;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author roc
 * @since 2021-07-26
 */
@Service
public class SsoUserDaoImpl extends ServiceImpl<SsoUserMapper, SsoUser> implements SsoUserDao {

    @Override
    public SsoUser queryByUserAccount(String userAccount) {
        SsoUser query = new SsoUser();
        query.setUserAccount(userAccount);
        QueryWrapper<SsoUser> queryWrapper = new QueryWrapper<SsoUser>(query);
        return this.getOne(queryWrapper);
    }

    @Override
    public SsoUser queryByUserId(String userId) {
        SsoUser query = new SsoUser();
        query.setUserId(userId);
        QueryWrapper<SsoUser> queryWrapper = new QueryWrapper<SsoUser>(query);
        return this.getOne(queryWrapper);
    }

    @Override
    public SsoUser queryByMobileNo(String mobileNo) {
        SsoUser query = new SsoUser();
        query.setMobileNo(mobileNo);
        QueryWrapper<SsoUser> queryWrapper = new QueryWrapper<SsoUser>(query);
        return this.getOne(queryWrapper);
    }

	@Override
	public int queryDeptUserCount(Long deptId) {
		SsoUser query = new SsoUser();
		query.setDeptId(deptId);
        QueryWrapper<SsoUser> queryWrapper = new QueryWrapper<SsoUser>(query);
		return this.count(queryWrapper);
	}

}
